﻿using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApp5
{
    //2、猫、狗、鸭、猴，（吃、游泳、爬树）
    class Animal
    {
        private string name;
        private string sex;

        public string Sex { get => sex; set => sex = value; }
        public string Name { get => name; set => sex = value; }
        public Animal(string name, string sex)
        {

            this.name = name;
            this.sex = sex;
        }
        public Animal() { }

    }
    class Cat : Animal, IEat, ISwim, IClimb
    {
        public void Climb()
        {
            Console.WriteLine("猫在爬树");
        }
        public void Eat()
        {
            Console.WriteLine("猫在吃猫粮");
        }
        public void Swim()
        {
            Console.WriteLine("猫在游泳");
        }
        public void Play()
        {
            Console.WriteLine("名字叫{0}，性别为{1}的小猫正在玩毛球", this.Name, this.Sex);
        }
        public Cat(string name, string sex) : base(name, sex)
        {

        }
    }
    class Dog : Animal, ISwim, IEat
    {
        public void Swim()
        {
            Console.WriteLine("狗在游泳");
        }
        public void Eat()
        {
            Console.WriteLine("狗在吃狗粮");
        }
        public void Play()
        {
            Console.WriteLine("名字叫{0}，性别为{1}的小狗正在咬树苗", this.Name, this.Sex);
        }
        public Dog(string name, string sex) : base(name, sex)
        {

        }
    }
    class Duck : Animal, ISwim, IEat
    {
        public void Swim()
        {
            Console.WriteLine("鸭子在游鸭泳");
        }
        public void Eat()
        {
            Console.WriteLine("鸭子吃饲料");
        }
        public void Play()
        {
            Console.WriteLine("名字叫{0}，性别为{1}的小鸭正在玩水", this.Name, this.Sex);
        }
        public Duck(string name, string sex) : base(name, sex)
        {

        }
    } 
    class Monkey : Animal, IClimb, IEat
    {
        public void Climb()
        {
            Console.WriteLine("猴子爬树");
        }
        public void Eat()
        {
            Console.WriteLine("猴子吃野桃");
        }
        public void Play()
        {
            Console.WriteLine("名字叫{0}，性别为{1}的皮猴正在爬树", this.Name, this.Sex);
        }
        public Monkey(string name, string sex) : base(name, sex)
        {

        }

    }
}
  